/**
 * Created by zero on 2016/9/25.
 */

$(".sa").click(function(){
    var username = $("#username").val();
    var password = $("#password").val();
    var checkval  = $('input[name="ions"]:checked').val();
    $.ajax({
        url:'/user/login',
        type:'post',
        data:{"username":username, "password":password},
        success: function(str){
            if(str == 1){
                if("check1" == checkval ){
                    window.location = "comlist.html?userid="+username;
                }else{
                    window.location = "comenter.html?userid="+username;
                }

            }else{
                setTimeout(function(){
                    $("#haserror").attr('class','has-error');
                    $("#tips").html("用户名或密码错误!");
                },800);
            }
        }
    });

});